home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2005 October / PCWOCT05.iso / Software / FromTheMag / The GIMP 2.2.8 / gimp-2.2.8-i586-setup.exe / {app} / share / gimp / 2.0 / scripts / beveled-pattern-heading.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2005-06-30  |  3.8 KB  |  117 lines

  1. ; The GIMP -- an image manipulation program
  2. ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
  3. ;
  4. ; Beveled pattern heading for web pages
  5. ; Copyright (C) 1997 Federico Mena Quintero
  6. ; federico@nuclecu.unam.mx
  7. ;
  8. ; This program is free software; you can redistribute it and/or modify
  9. ; it under the terms of the GNU General Public License as published by
  10. ; the Free Software Foundation; either version 2 of the License, or
  11. ; (at your option) any later version.
  12. ;
  13. ; This program is distributed in the hope that it will be useful,
  14. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. ; GNU General Public License for more details.
  17. ;
  18. ; You should have received a copy of the GNU General Public License
  19. ; along with this program; if not, write to the Free Software
  20. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21. ; ************************************************************************
  22. ; Changed on Feb 4, 1999 by Piet van Oostrum <piet@cs.uu.nl>
  23. ; For use with GIMP 1.1.
  24. ; All calls to gimp-text-* have been converted to use the *-fontname form.
  25. ; The corresponding parameters have been replaced by an SF-FONT parameter.
  26. ; ************************************************************************
  27.  
  28.  
  29. (define (script-fu-beveled-pattern-heading
  30.      text text-size font pattern transparent)
  31.   (let* ((img (car (gimp-image-new 10 10 RGB)))
  32.      (textl
  33.       (car
  34.        (gimp-text-fontname img -1 0 0 text 0 TRUE text-size PIXELS font)))
  35.  
  36.      (width (car (gimp-drawable-width textl)))
  37.      (height (car (gimp-drawable-height textl)))
  38.  
  39.      (background (car (gimp-layer-new img
  40.                       width height RGBA-IMAGE
  41.                       "Background" 100 NORMAL-MODE)))
  42.      (bumpmap (car (gimp-layer-new img
  43.                        width height RGBA-IMAGE
  44.                        "Bumpmap" 100 NORMAL-MODE))))
  45.  
  46.     (gimp-context-push)
  47.  
  48.     (gimp-image-undo-disable img)
  49.     (gimp-image-resize img width height 0 0)
  50.     (gimp-image-add-layer img background 1)
  51.     (gimp-image-add-layer img bumpmap 1)
  52.  
  53.     ; Create pattern layer
  54.  
  55.     (gimp-context-set-background '(0 0 0))
  56.     (gimp-edit-fill background BACKGROUND-FILL)
  57.     (gimp-context-set-pattern pattern)
  58.     (gimp-edit-bucket-fill background
  59.                PATTERN-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0)
  60.  
  61.     ; Create bumpmap layer
  62.  
  63.     (gimp-edit-fill bumpmap BACKGROUND-FILL)
  64.  
  65.     (gimp-context-set-background '(127 127 127))
  66.     (gimp-selection-layer-alpha textl)
  67.     (gimp-selection-shrink img 1)
  68.     (gimp-edit-fill bumpmap BACKGROUND-FILL)
  69.  
  70.     (gimp-context-set-background '(255 255 255))
  71.     (gimp-selection-layer-alpha textl)
  72.     (gimp-selection-shrink img 2)
  73.     (gimp-edit-fill bumpmap BACKGROUND-FILL)
  74.  
  75.     (gimp-selection-none img)
  76.  
  77.     ; Bumpmap
  78.  
  79.     (plug-in-bump-map 1 img background bumpmap 135 45 2 0 0 0 0 TRUE FALSE 0)
  80.  
  81.     ; Clean up
  82.  
  83.     (gimp-context-set-background '(0 0 0))
  84.     (gimp-selection-layer-alpha textl)
  85.     (gimp-selection-invert img)
  86.     (gimp-edit-clear background)
  87.     (gimp-selection-none img)
  88.  
  89.     (gimp-image-set-active-layer img background)
  90.     (gimp-image-remove-layer img bumpmap)
  91.     (gimp-image-remove-layer img textl)
  92.  
  93.     (if (= transparent FALSE)
  94.     (gimp-image-flatten img))
  95.  
  96.     (gimp-image-undo-enable img)
  97.     (gimp-display-new img)
  98.  
  99.     (gimp-context-pop)))
  100.  
  101.  
  102. (script-fu-register "script-fu-beveled-pattern-heading"
  103.             _"H_eading..."
  104.             "Beveled pattern heading"
  105.             "Federico Mena Quintero"
  106.             "Federico Mena Quintero"
  107.             "July 1997"
  108.             ""
  109.             SF-STRING     _"Text"                   "Hello world!"
  110.             SF-ADJUSTMENT _"Font size (pixels)"     '(72 2 200 1 1 0 1)
  111.             SF-FONT       _"Font"                   "Sans"
  112.             SF-PATTERN    _"Pattern"                "Wood"
  113.             SF-TOGGLE     _"Transparent background" FALSE)
  114.  
  115. (script-fu-menu-register "script-fu-beveled-pattern-heading"
  116.              _"<Toolbox>/Xtns/Script-Fu/Web Page Themes/Beveled Pattern")
  117.